package com.geovis.emergency.spd.controller.app;

import com.geovis.common.core.api.Result;
import com.geovis.emergency.spd.biz.app.service.AppMsgService;
import com.geovis.emergency.spd.entity.app.dto.AppMsgDto;
import com.geovis.emergency.spd.entity.app.entity.AppMsg;
import com.geovis.emergency.spd.entity.custom.entity.ResourceTreeDto;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 信息发布 前端控制器
 * </p>
 *
 * @author Lonsho
 * @since 2022-06-08
 */
@RestController
@RequestMapping("/app/msg")
@RequiredArgsConstructor
@Api(value = "信息发布模块接口", tags = "信息发布模块接口")
@Slf4j
@Validated
public class MsgController {


    private final AppMsgService appMsgService;
    @ApiOperation(value = "保存信息", notes = "保存信息")
    @PostMapping({"/save"})
    public Result save(@RequestBody @Validated AppMsgDto appMsgDto) {
        appMsgService.saveMsg(appMsgDto);
        return Result.ok();
    }

    @ApiOperation(value = "获取当前用户的信息列表", notes = "获取当前用户的信息列表")
    @GetMapping({"/getList"})
    public Result<List<AppMsg>> getTreeList(){
        return Result.ok(appMsgService.getList());
    }



}
